{
int i;
int n = waypt_count();
+#if NEWQ
+ extern QList<Waypoint*> waypt_list;
+#else
queue* elem, *tmp;
extern queue waypt_head;
+#endif
int icon;
tx_waylist = (struct GPS_SWay**) xcalloc(n,sizeof(*tx_waylist));
i = 0;
+#if NEWQ
+ // Iterate with waypt_disp_all?
+ foreach(Waypoint* wpt, waypt_list) {
+#else
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
- Waypoint* wpt;
+ Waypoint* wpt = (Waypoint*) elem;
+#endif
char* ident;
char obuf[256];
- wpt = (Waypoint*) elem;
#if NEW_STRINGS
QString src;
if (!wpt->description.isEmpty()) {
/* from waypt.c, we need to iterate over waypoints when extracting
routes */
+#if NEWQ
+extern QList<Waypoint*> waypt_list;
+#else
extern queue waypt_head;
+#endif
static gbfile* file_in;
static gbfile* file_out;
static Waypoint*
lowranceusr4_find_waypt(int uid_unit, int uid_seq_low, int uid_seq_high)
{
+#if !NEWQ
queue* elem, *tmp;
- Waypoint* waypointp;
+#endif
lowranceusr4_fsdata* fs = NULL;
+#if NEWQ
+ // Iterate with waypt_disp_all?
+ foreach(Waypoint* waypointp, waypt_list) {
+#else
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
- waypointp = (Waypoint*) elem;
+ Waypoint* waypointp = (Waypoint*) elem;
+#endif
fs = (lowranceusr4_fsdata*) fs_chain_find(waypointp->fs, FS_LOWRANCEUSR4);
if (fs && fs->uid_unit == uid_unit &&
void
radius_process(void)
{
+#if !NEWQ
queue* elem, * tmp;
- Waypoint* waypointp;
+#endif
double dist;
Waypoint** comp;
int i, wc;
foreach(Waypoint* waypointp, waypt_list) {
#else
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
- waypointp = (Waypoint*)elem;
+ Waypoint* waypointp = (Waypoint*)elem;
#endif
dist = gc_distance(waypointp->latitude,
waypointp->longitude,
* for qsort.
*/
+#if NEWQ
+ foreach(Waypoint* wp, waypt_list) {
+#else
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
Waypoint* wp = (Waypoint*) elem;
+#endif
comp[i] = wp;
waypt_del(wp);
i++;
{
int ct = waypt_count();
struct hdr* htable, *bh;
+#if NEWQ
+ extern QList<Waypoint*> waypt_list;
+#else
queue* elem, *tmp;
extern queue waypt_head;
- Waypoint* waypointp;
+#endif
double minlon = 200;
double maxlon = -200;
double minlat = 200;
htable = (struct hdr*) xmalloc(ct * sizeof(*htable));
bh = htable;
+#if NEWQ
+ // Iterate with waypt_disp_all?
+ foreach(Waypoint* waypointp, waypt_list) {
+#else
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
- waypointp = (Waypoint*) elem;
+ Waypoint* waypointp = (Waypoint*) elem;
+#endif
bh->wpt = waypointp;
if (waypointp->longitude > maxlon) {
maxlon = waypointp->longitude;
wpt->shortname = wpt->notes;
} else {
QString n;
- n.sprintf("%03d", waypt_ct);
+ n.sprintf("%03d", waypt_count());
wpt->shortname = QString("WPT%1").arg(n);
}
}
void
waypt_del(Waypoint* wpt)
{
+ // the wpt must be on waypt_list, and is assumed unique.
#if NEWQ
+ waypt_list.removeOne(wpt);
#else
dequeue(&wpt->Q);
waypt_ct--;
if ((se == NULL) || (waypointp->session == se)) {
if (global_opts.verbose_status) {
i++;
- waypt_status_disp(waypt_ct, i);
+ waypt_status_disp(waypt_count(), i);
}
(*cb)(waypointp);
}
void
waypt_flush(queue* head)
{
- while (!waypt_list.isEmpty()) {
- delete waypt_list.takeFirst();
+// TODO: This is incorrect when head != &waypt_head
+// We need to pass in a QList<Waypoint*> instead of a queue* that we ignore!
+ if (head != &waypt_head) {
+ if (global_opts.debug_level >= 1) {
+ warning("NEWQ version of waypt_flush is unimplemented for this list.\n");
+ }
+ } else {
+ while (!waypt_list.isEmpty()) {
+ delete waypt_list.takeFirst();
+ }
}
}
#else
mkshort_del_handle(&mkshort_handle);
}
#if NEWQ
+ // TODO: eventually we shoud pass the list instead of the queue.
+ waypt_flush(&waypt_head);
#else
waypt_flush(&waypt_head);
#endif